<include file="Public/header"/>
<body class="body-bg">
<div class="park-header">
    <div class="park-header__title">{:session('store_name')}</div>
</div>
<div class="park-order-nav-tabs">
    <ul>
        <li onclick="get_order(1);" <if condition="$type eq 1">class="active"</if>>全部</li>
        <li onclick="get_order(2);" <if condition="$type eq 2">class="active"</if>>待付款</li>
        <li onclick="get_order(3);" <if condition="$type eq 3">class="active"</if>>待收货</li>
        <li onclick="get_order(4);" <if condition="$type eq 4">class="active"</if>>待评价</li>
        <li onclick="get_order(5);" <if condition="$type eq 5">class="active"</if>>已完成</li>
    </ul>
</div>
<div class="container mb-footer">
    <div class="park-cart-store-list" id="order_list"></div>
</div>
<include file="Public/footer"/>
<script>
    function get_order(num){
        window.location = '/Business/Index/Home/type/'+num;
    }
    var options = {
        type: 'get', // default 'get'
        dataType: 'html' // default 'json'
    };
    $(function () {
        var type = '{$type}';
        var url = '/Business/Index/home/';
        var params = {'act':'ajax','type':type};
        PARK.dropLoad(PARK.dropAjax(options, url, params, function (data) {
            var data = JSON.parse(data);
            var html = '';
            for (var i = 0; i < data.result.length; i++) {
                html+='<div class="park-cart-store-item">';
                html+='     <div class="park-cart-store-item__title">';
                html+='        <div class="left"><span>订单号：'+data['result'][i]['order_sn']+'</span></div>';
                html+='        <div class="right">'+data['result'][i]['status_name']+'</div>';
                html+='    </div>';
                html+='    <div class="park__goods">';
                html+='        <ul>';
                for(var j=0;j<data['result'][i]['goods_list'].length;j++) {
                    html += '            <li>';
                    html += '               <div class="park-goods__pic" style="background-image: url('+data['result'][i]['goods_list'][j]['thumb']+')"></div>';
                    html += '                <div class="park-goods__info">';
                    html += '                    <p class="name">'+data['result'][i]['goods_list'][j]['goods_name']+'</p>';
                    html += '                    <p class="desc">'+data['result'][i]['goods_list'][j]['keywords']+'</p>';
                    html += '                    <p class="spec">规格：'+data['result'][i]['goods_list'][j]['spec_name']+'</p>';
                    html += '                    <p class="price-line">';
                    html += '                        <span class="price">￥<em>'+data['result'][i]['goods_list'][j]['left_price']+'</em>'+data['result'][i]['goods_list'][j]['right_price']+'</span>';
                    html += '                    </p>';
                    html += '                </div>';
                    html += '                <div class="park-goods__pos">';
                    html += '                    <span class="num">X'+data['result'][i]['goods_list'][j]['goods_number']+'</span>';
                    html += '                </div>';
                    html += '            </li>';
                }
                html+='        </ul>';
                html+='    </div>';
                html+='    <div class="park-order-edit">';
                html+='        <div class="park-order-edit__time">下单时间：'+data['result'][i]['add_time']+'</div>';
                html+='    </div>';
                html+='</div>';
            }
            $('#order_list').append(html);
            if(data.is_page==1){
                PARK.unDropLoad();
            }
        }));
    });
</script>
</body>
</html>